<!doctype html>

<html>

<head>
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Demo of Firefly Tools</title>
</head>

<body>

<div id="fireflyLostConnWarn" data-decor="medium" class="warning-div right"></div>


<div style="width: 500px; padding: 50px 0 0 20px;">
    <h3>Firefly - new API demo</h3>
    <a href="javascript:loadMoving()">load Images</a>
</div>

<div>
    <div id="image1_div" style="display: inline-block; width: 550px; height: 550px; margin: 10px;"></div>
    <div id="image2_div" style="display: inline-block; width: 550px; height: 550px; margin: 10px;"></div>
</div>


<script type="text/javascript">
    {

        function onFireflyLoaded() {

            firefly.setGlobalImageDef({
                ZoomType: 'TO_WIDTH',
                ColorTable: 0 // 数字对应 颜色列表下面的颜色列表 参考文档fits-plotting-parameters.md
            });

            firefly.action.dispatchWcsMatch({ 
              matchType: 'Pixel',  
              lockMatch: true  
            });

            firefly.debug = true;

            const req1 = {
                plotId: 'image1',
                file: '/data/fits_images/nfsroot-vxpp/L1X/Imaging/2025-05-01/ToO-NOM-GRB-5073/SVT_ToO-NOM-GRB_05073_R_04637_250501T051931_23371.fit',
                Title: 'SVT_GP-PPT_04983_R_04604_250429T000129_22054.fit'
            };

            firefly.showImage('image1_div', req1);
            const req2 = {
                plotId: 'image2',
                file: '/data/fits_images/nfsroot-vxpp/L1X/Imaging/2025-04-29/GP-PPT-4983/SVT_GP-PPT_04983_B_04604_250429T000129_22054.fit',
                Title: '2025-04-29/GP-PPT-4983/SVT_GP-PPT_04983_B_04604_250429T000129_22054.fit'
            };
            firefly.showImage('image2_div', req2);


            const regionAry = [  
                'image; box 250 250 100 80 0 # color=red',  
                'image; box 250 250 50 40 0 # color=red'  
            ];  
            firefly.action.dispatchCreateRegionLayer(
                'region112',   // 区域层ID  
                'Region Layer 1',  // 区域层标题  
                null, // 无文件路径  
                regionAry,  // 区域数组  
                ['image2'] // 要显示区域的图像ID  
            );
        }
    }
</script>


<script src="http://10.34.1.111:5066/firefly/firefly_loader.js"></script>

</body>
</html>